// pages/list/list.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    topAdd: 0,
    info: {
        name: '未登录'
    },
    carList: [],
  },

  infoBtnAction(){
    if(this.data.info.name === '未登录') {
      wx.navigateTo({
        url: '/pages/login/login',
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
  },

  onShow(){
    this.requestDriverInfo();
  },
  // 账号基本新信息
  async requestDriverInfo() {
    const { userRealname = '' } = app.globalData.userInfo || {}
    if(userRealname && userRealname != '未登录') {
      this.setData({
        'info.name': userRealname,
      })
    } else {
        this.setData({
            'info.name': '未登录',
            driverFlag: 0,
            vehicleFlag: 0
        })
    }
    console.log(this.data.info.name)
  },

  listAction(){
    console.log(123123)
    wx.navigateTo({
      url: '/pages/rules/ruleList/ruleList',
    })
  }
})